package com.miyake.dsp.osa;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class LogTrace {
	private static boolean logTrace = false; 
	
	public static void writeLog(String s) {
		if (!isLogEnabled()) {
			return;
		}
		try {
		
			BufferedWriter logWriter = new BufferedWriter(new FileWriter(new File("log.text"), true));
			logWriter.write(s);
			logWriter.newLine();
			logWriter.flush();
			logWriter.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static boolean isLogEnabled() {
		return logTrace;
	}
	public static void setLogEnabled(boolean b) {
		logTrace = b;
	}
}
